package com.fang.牛客;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

public class HJ94_记票统计 {
    private static final String INVALID = "Invalid";
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {

            Map<String, Integer> hash = new LinkedHashMap<String, Integer>();
            int canNum = sc.nextInt();
            sc.nextLine();
            String[] candidates = sc.nextLine().split(" ");
            int voteNum = sc.nextInt();
            sc.nextLine();
            String[] voters = sc.nextLine().split(" ");
            for (String candidate : candidates) {
                hash.put(candidate, 0);
            }
            hash.put(INVALID, 0);
            for (String voter : voters) {
                if (hash.containsKey(voter)) {
                    hash.put(voter, hash.get(voter) + 1);
                } else {
                    hash.put(INVALID, hash.get(INVALID) + 1);
                }
            }
            hash.forEach((k, v) -> {
                System.out.println(k + " : " + v);
            });
        }
    }
}
